import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
const pathResolve = (dir) => resolve(__dirname, ".", dir);
import commonjs from "vite-plugin-commonjs";

// https://vitejs.dev/config/
export default defineConfig({
  base: "/admin/",
  plugins: [vue(), commonjs(),// * 使用 svg 图标
  createSvgIconsPlugin({
    iconDirs: [resolve(process.cwd(), "src/assets/icons")],
    symbolId: "icon-[dir]-[name]"
  }),],
  server: {
    host: true,
    port: "5555",
  },
  resolve: {
    alias: [
      { find: "@", replacement: pathResolve("src") },
      { find: "*", replacement: pathResolve("./") },
    ],
  },
});
